package 富婆梦.第一阶段.第八周Scoket.练习题;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.Socket;

/**
 * @ProjectName: java-learning
 * @Package: 富婆梦.第一阶段.第八周Scoket
 * @ClassName: DailyAdviceClient
 * @Author: hemengjin
 * @Description: Scoket客户端
 * @Date:2021/9/20 9:55
 * @Version: 1.0
 */
public class DailyAdviceClient {
    public void go(){
        try {
            Socket s = new Socket("192.168.1.18",8888);
            InputStreamReader streamReader = new InputStreamReader(s.getInputStream());
            BufferedReader bufferedReader = new BufferedReader(streamReader);
            String advice = bufferedReader.readLine();
            System.out.println("The Advice is:"+advice);
            bufferedReader.close();
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        DailyAdviceClient client = new DailyAdviceClient();
        client.go();
    }
}
